package com.example.dicomviewer.reconstruction;

import android.opengl.GLES20;
import android.opengl.GLSurfaceView;
import android.util.Log;


import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

public class BackgroundRender extends BaseRenderer implements GLSurfaceView.Renderer {

    private String TAG = BackgroundRender.class.getSimpleName();

    private float[] cameraPos = new float[3];
    private float[] center = new float[3];
    private float radius = 100;


    @Override
    public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {
        //surface被创建后需要做的处理
        //Set the background frame color
        GLES20.glClearColor(102, 204, 255, 1.0f);

        cameraPos[0] = 0;
        cameraPos[1] = 0;
        cameraPos[2] = radius;

        center[0] = 256;
        center[1] = 256;
        center[2] = 50;

    }

    @Override
    public void onSurfaceChanged(GL10 gl10, int width, int height) {
        // 渲染窗口大小发生改变或者屏幕方法发生变化时候回调
        GLES20.glViewport(0, 0, width, height);
    }

    @Override
    public void onDrawFrame(GL10 gl10) {
        Log.d(TAG, "<onDrawFrame>");
        //执行渲染工作
        //Redraw background color
        GLES20.glClearColor(GLES20.GL_COLOR_BUFFER_BIT, 0f, 0f, 0f);
    }
}